package com.more.offer.threadtest.locksupport;

import java.sql.SQLOutput;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.LockSupport;

/**
 * @author pinoc
 * @date 2021/6/25
 * @description
 */
public class LockSupportTest {

	public static void main(String[] args) throws InterruptedException {

		LockSupport.unpark(Thread.currentThread());
		LockSupport.park();
		System.out.println("end park");

		Thread thread = new Thread(() -> {
			System.out.println("child thread begin park");
			LockSupport.park();
			System.out.println("child thread unpark");
		});

		thread.start();
		Thread.sleep(2000);

		System.out.println("main thread begin unpark");

		LockSupport.unpark(thread);
	}
}
